package cn.miao.middle.cloud.core.port;

import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.context.ApplicationListener;

import cn.miao.middle.cloud.core.port.props.RandomServerPortPropertySource;

/**
 * 用于监听随机端口问题
 * 
 * @author kongyufei
 *
 */
public class PortApplicationEnvironmentPreparedEventListener
		implements ApplicationListener<ApplicationEnvironmentPreparedEvent> {

	@Override
	public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
		event.getEnvironment().getPropertySources().addLast(new RandomServerPortPropertySource());
	}
}
